package com.zankong.tool.zkapp.document.plain;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.LinearLayout;

import com.eclipsesource.v8.JavaCallback;
import com.eclipsesource.v8.V8Array;
import com.eclipsesource.v8.V8Function;
import com.eclipsesource.v8.V8Object;
import com.zankong.tool.zkapp.R;
import com.zankong.tool.zkapp.ZKToolApi;
import com.zankong.tool.zkapp.document.ZKDocument;
import com.zankong.tool.zkapp.util.Util;
import com.zankong.tool.zkapp.util.ZKAppDocument;
import com.zankong.tool.zkapp.views.ZKViews;

import org.dom4j.Element;

/**
 * Created by YF on 2018/6/22.
 */

@ZKAppDocument("plain")
public class ZKPlain extends ZKDocument {
    private LinearLayout        mHeader,           //头布局
                                mBody,             //身体可滑动区域
                                mFooter;           //尾布局

    public ZKPlain(Context context, Element root, Window window) {
        super(context, root, window);
    }

    public ZKPlain(Context context, Element root, ViewGroup viewGroup) {
        super(context, root, viewGroup);
    }

    @Override
    protected void initV8This() {
        super.initV8This();
    }

    @Override
    protected void initView() {
        setContextView(R.layout.doc_plain);
        analysisDoc(mElement,findViewById(R.id.back_layout),null);
        mHeader = ((LinearLayout) findViewById(R.id.header));
        mBody = ((LinearLayout) findViewById(R.id.body));
        mFooter = ((LinearLayout) findViewById(R.id.footer));
    }

    @Override
    protected void fillData(Element docElement) {
        for (Element element : docElement.elements()) {
            switch (element.getName().toLowerCase()) {
                case "header":
                    setXml(element,mHeader);
                    break;
                case "body":
                    setXml(element,mBody);
                    break;
                case "footer":
                    setXml(element,mFooter);
                    break;
            }
        }
    }

}
